<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title></title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">

    <meta name="viewport" content="width=device-width"/>
    <meta name="viewport" content="initial-scale=1.0,user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes">

    <!-- Bootstrap CSS-->
    <link rel="stylesheet" href="/vendor/bootstrap/css/bootstrap.min.css">
    <!-- Font Awesome CSS-->
    <link rel="stylesheet" href="/vendor/font-awesome/css/font-awesome.min.css">
    <!-- Fontastic Custom icon font-->
    <link rel="stylesheet" href="/css/fontastic.css">
    <!-- Google fonts - Poppins -->
    <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,700">
    <!-- theme stylesheet-->
    <link rel="stylesheet" href="/css/style.default.css" id="theme-stylesheet">
    <!-- Custom stylesheet - for your changes-->
    <link rel="stylesheet" href="/css/custom.css">
    <!-- Favicon-->
    <link rel="shortcut icon" href="/img/favicon.ico">
    <!-- Tweaks for older IEs--><!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script><![endif]-->
    <!-- JavaScript files-->
    <script src="/vendor/jquery/jquery.min.js"></script>
    <script src="/vendor/popper.js/umd/popper.min.js"></script>
    <script src="/vendor/bootstrap/js/bootstrap.min.js"></script>
    <script src="/vendor/jquery.cookie/jquery.cookie.js"></script>
    <script src="/vendor/chart.js/Chart.min.js"></script>
    <script src="/vendor/jquery-validation/jquery.validate.min.js"></script>
    <!-- Main File-->
    <script src="/js/front.js"></script>
    <script type="text/javascript">
        function intOnly() {
            var codeNum = $.trim($("#mypositioningPhoneNumber").val());
            if (codeNum == "") {
                alert("手机号不能为空");
                return false;
            }
            if (codeNum.length != 11) {
                alert("手机号只能为11位数字");
            }
            if (codeNum == 8 || codeNum == 37 || codeNum == 39 || (codeNum >= 48 && codeNum <= 57)) {
                event.returnValue = codeNum;
            } else {
                event.returnValue = false;
            }
        }
        function toViewMap() {
            var mypositioningPhoneNumber = $.trim($("#mypositioningPhoneNumber").val());
            var mypositioningName = $.trim($("#mypositioningName").val());
            console.log('mypositioningPhoneNumber:' + mypositioningPhoneNumber + 'mypositioningName:' + mypositioningName);

            if (mypositioningPhoneNumber == "") {
                alert("手机号码不能为空");
                return false;
            }

            if (mypositioningPhoneNumber.length != 11) {
                alert("手机号码长度必须为11位");
            }

            var resultUrl = "";
            var newWindow = window.open();

            newWindow.location.href = "/rechargeRecord/recharge_monthly?phoneNum=" + mypositioningPhoneNumber;

            closeWebPage();
        }
           /* $.ajax({
                type: "POST",
                url: "/mypositioning/viewMap",
                data: {"mypositioningPhoneNumber": mypositioningPhoneNumber, "mypositioningName": mypositioningName},
                cache: false,
                async: false,
                dataType: "json",
                complete: function (ret) {
                    var jsonVar = eval(JSON.parse(ret.responseText));
                    //debugger;
                    if (jsonVar.status == 1 && jsonVar.code == "0000") {
                        resultUrl = jsonVar.object;
                    } else if ("登录超时请重新登录" == jsonVar.message) {
                        alert(jsonVar.message);
                        resultUrl = jsonVar.object;
                    } else if ("余额不足请充值" == jsonVar.message) {
                        // alert("余额不足请充值");
                        resultUrl = jsonVar.object;
                    } else if ("手机号码不能为空" == jsonVar.message) {
                        alert("手机号码不能为空");
                        return false;
                    } else {
                        $("#mypositioningPhoneNumber").val("");
                        $("#mypositioningName").val("");
                        alert(jsonVar.message);
                    }
                }, error: function (retMsg) {
                    alert("定位出错...");
                    resultUrl = "/userManagement/loginIndex";
                }
            });
            if (null != resultUrl && "" != resultUrl) {
                console.log('resultUrl:' + resultUrl);
                newWindow.location.href = resultUrl;

                closeWebPage();
            }
        }*/

        //兼容多浏览器关闭当前页-- 经测试IE可以；chrome打开一个可以，多个不可以；FireFox是把当前页内容变成空白的，窗口不关闭
        function closeWebPage(){
            if (navigator.userAgent.indexOf("MSIE") > 0) {//close IE
                if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
                    window.opener = null;
                    window.close();
                } else {
                    window.open('', '_top');
                    window.top.close();
                }
            }
            else if (navigator.userAgent.indexOf("Firefox") > 0) {//close firefox
                window.location.href = 'about:blank ';
            } else {//close chrome;It is effective when it is only one.
                window.opener = null;
                window.open('', '_self');
                window.close();
            }
        }
    </script>
</head>
<body>
<div class="page">
    <div class="page-content d-flex align-items-stretch">
        <div class="content-inner">
            <!--<header class="page-header">
                <div class="container-fluid">
                    <h2 class="no-margin-bottom">手机定位</h2>
                </div>
            </header>-->
            <!-- Breadcrumb-->
            <div class="breadcrumb-holder container-fluid">
                <ul class="breadcrumb">
                    <li class="breadcrumb-item"><a href="/userManagement/mainIndex">我的</a></li>
                </ul>
            </div>
            <!-- Forms Section-->
            <section class="forms">
                <div class="container-fluid">
                    <div class="row">
                        <!-- Form Elements -->
                        <div class="col-lg-12">
                            <div class="card">
                                <div class="card-body">
                                    <form class="form-horizontal">
                                        <div class="form-group row">
                                            <div class="col-sm-9">
                                                <input type="text" id="mypositioningPhoneNumber"
                                                       name="mypositioningPhoneNumber"
                                                       placeholder="请输入对方手机号" maxlength="11"
                                                       onchange="intOnly();" class="form-control">
                                            </div>
                                        </div>
                                        <!--<div class="line"></div>
                                        <div class="form-group row">
                                            <div class="col-sm-9">
                                                <input type="text" id="mypositioningName" maxlength="10"
                                                       name="mypositioningName"
                                                       placeholder="请输入联系人姓名(选填)" class="form-control"/>
                                            </div>
                                        </div>-->
                                        <div class="line"></div>
                                        <div class="form-group row">
                                            <div class="col-sm-9">
                                                <label class="form-control-label">1,使用时请尊重对方隐私</label>
                                                <br/>
                                                <label class="form-control-label">2,只有会员用户才可以使用手机定位</label>
                                            </div>
                                        </div>
                                        <div class="line"></div>
                                        <!--<div class="form-group row">
                                            <div class="col-sm-9">
                                                <label class="form-control-label">2,只有会员用户才可以使用手机定位</label>
                                            </div>
                                        </div>-->
                                        <div class="form-group row">
                                            <div class="col-sm-9 offset-sm-3">
                                                <input type="submit" value="获取定位"
                                                       onclick="toViewMap();"
                                                       class="btn btn-primary">
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

            </section>
        </div>
    </div>
</div>

</body>
</html>